package com.nbsaas.boot.project.rest.convert;

import com.nbsaas.boot.project.api.domain.response.ProjectTravelResponse;
import com.nbsaas.boot.project.data.entity.ProjectTravel;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
/**
 * 出差-实体对象转化成响应对象
 */

public class ProjectTravelResponseConvert implements Converter<ProjectTravelResponse, ProjectTravel> {

    @Override
    public ProjectTravelResponse convert(ProjectTravel source) {
        ProjectTravelResponse result = new ProjectTravelResponse();
        BeanDataUtils.copyProperties(source, result);
        if (source.getProject() != null) {
            result.setProject(source.getProject().getId());
        }

        try {
            if (source.getProject() != null) {
                result.setProjectName(source.getProject().getName());
            }
        } catch (Exception ignored) {
        }

        return result;
    }

}

